package com.qst.control;

import com.qst.service.UserInfoManagerService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
import java.util.Map;

@WebServlet("/getUserByID")
public class GetOneUserInfoServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//        接收用户的id
       Integer userid= Integer.parseInt(req.getParameter("userid"));
//       创建业务逻辑层对象
        UserInfoManagerService service=new UserInfoManagerService();
//        调用getOneUserInfo方法进行数据用户信息
        List<Map<String,Object>> lm=service.getOneUserInfo(userid);
//        将用户信息存储在session中
        req.getSession().setAttribute("userinfo",lm);
//        进行页面跳转
        req.getRequestDispatcher("UpdateUserInfo.jsp").forward(req,resp);

    }
}
